<?php
/**
 * Created by openXtiger.org.
 * User: lunzi
 * Date: 2009-6-27
 * Time: 17:20:47
 * To change this template use File | Settings | File Templates.
 */

/*public */function membermodel_findMemberByUserId($uid) {
    $db = xt_load('db');
    return $db->fetch_first("SELECT * FROM `icweb_members` WHERE uid= '$uid'");
}

/*public */function membermodel_findMemberInfoByUserId($uid) {
    $db = xt_load('db');
    return $db->fetch_first("SELECT * FROM `icweb_members_info` WHERE uid= '$uid'");
}

/*public */function membermodel_updateMemberByUserId($uid,$real_name,$pen_name,$email,$tel,$fax,$mobile_phone,$post_no,$comany_area,$street_address,$sex) {
    $db = xt_load('db');
    $sql = "update `icweb_members` ";
    $sql .="set real_name='$real_name', ";
    $sql .="pen_name='$pen_name', ";
    $sql .="email='$email', ";
    $sql .="tel='$tel', ";
    $sql .="fax='$fax', ";
    $sql .="mobile_phone='$mobile_phone', ";
    $sql .="post_no='$post_no', ";
    $sql .="comany_area='$comany_area', ";
    $sql .="street_address='$street_address', ";
    $sql .="sex='$sex' ";
    $sql .="WHERE uid= $uid ";
    //echo $sql;
    return $db->fetch_first($sql);
    //return $db->fetch_first("update `icweb_members` set real_name='$real_name',pen_name='$pen_name',email='$email',tel='$tel',fax='$fax',mobile_phone='$mobile_phone',post_no='$post_no',comany_area='$comany_area' WHERE uid= '$uid'");
}

/*public */function membermodel_updateMemberByUid($uid,$real_name,$tel,$fax,$email,$post_no,$mobile_phone,$area,$street_address) {
    $db = xt_load('db');
    $sql = "update `icweb_members` ";
    $sql .="set real_name='$real_name', ";
    $sql .="tel='$tel', ";
    $sql .="fax='$fax', ";
    $sql .="email='$email', ";
    $sql .="post_no='$post_no', ";
    $sql .="mobile_phone='$mobile_phone', ";
    $sql .="comany_area='$area', ";
    $sql .="street_address='$street_address' ";
    $sql .="WHERE uid= $uid ";
    //echo $sql;
    return $db->fetch_first($sql);
    //return $db->fetch_first("update `icweb_members` set real_name='$real_name',pen_name='$pen_name',email='$email',tel='$tel',fax='$fax',mobile_phone='$mobile_phone',post_no='$post_no',comany_area='$comany_area' WHERE uid= '$uid'");
}

/*public */function membermodel_updateMemberInfoByUserId($uid,$blood_type,$head_pic,$birthday,$income_level,$education,$native_place,$faith,$homepage,$hobby,$self_intr) {
    $db = xt_load('db');
    $sql = "update `icweb_members_info` ";
    $sql .="set blood_type='$blood_type', ";
    $sql .="head_pic='$head_pic', ";
    $sql .="birthday='$birthday', ";
    $sql .="income_level='$income_level', ";
    $sql .="education='$education', ";
    $sql .="native_place='$native_place', ";
    $sql .="faith='$faith', ";
    $sql .="homepage='$homepage', ";
    $sql .="hobby='$hobby', ";
    $sql .="self_intr='$self_intr' ";
    $sql .=" WHERE uid= '$uid'";
    //echo $sql;
    return $db->fetch_first($sql);
    //return $db->fetch_first("update `icweb_members_info` set blood_type='$blood_type' WHERE uid= '$uid'");
}
     
/*public */function membermodel_updateCompanyByUid($uid,$comany_name,$jobs,$buy_product,$sale_product,$comany_industry,$sales_style,$site_url,$dept) {
    $db = xt_load('db');
    return $db->fetch_first("update `icweb_company` set comany_name='$comany_name',jobs='$jobs', buy_product='$buy_product',sale_product='$sale_product',comany_industry='$comany_industry',sale_product='$sale_product',sales_style='$sales_style',site_url='$site_url',dept='$dept' WHERE uid= '$uid'");
}

?>